/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.asseco.mio;
import com.asseco.mio.codex.EmploymentReason;
import com.asseco.mio.codex.Institution;
import com.asseco.mio.codex.LeaveReason;
import com.asseco.mio.codex.PosType;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import org.appfuse.model.BaseObject;
import org.hibernate.annotations.GenericGenerator;
/**
 *
 * @author gjoko.mitrovski
 */
@Entity
@Table(name = "WORK_POSITION")
public class WorkPosition extends BaseObject {

    private String id;
    private Institution institution;
    private BasicInfo employment;
    private String discriminator;
    private String position;
    private Boolean trialPeriod;
    private PosType posType;
    private Boolean status;
    private Date activeDate;
    private Date passiveDate;
    private Date startDate;
    private Date endDate;
    private EmploymentReason emplReason;
    private LeaveReason leaveReason;
    private String experience;



    @Column(name = "ACTIVE_DATE")
    @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
    public Date getActiveDate() {
        return activeDate;
    }


    public void setActiveDate(Date activeDate) {
        this.activeDate = activeDate;
    }
   @Column(name = "DISCRIMINATOR", length = 50)
    public String getDiscriminator() {
        return discriminator;
    }

    public void setDiscriminator(String discriminator) {
        this.discriminator = discriminator;
    }
    @ManyToOne
   @JoinColumn(name = "EMPL_REASON_ID")
    public EmploymentReason getEmplReason() {
        return emplReason;
    }

    public void setEmplReason(EmploymentReason emplReason) {
        this.emplReason = emplReason;
    }
    @ManyToOne
   @JoinColumn(name = "EMP_ID")
    public BasicInfo getEmployment() {
        return employment;
    }

    public void setEmployment(BasicInfo employment) {
        this.employment = employment;
    }
@Column(name = "END_DATE")
    @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    @Column(name = "START_DATE")
    @Temporal(value = javax.persistence.TemporalType.DATE)
    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

   @Column(name = "EXPERIENCE", length = 200)
    public String getExperience() {
        return experience;
    }

    public void setExperience(String experience) {
        this.experience = experience;
    }
 @Id
    @GeneratedValue(generator = "system-uuid")
    @Column(length = 40)
@GenericGenerator(name = "system-uuid", strategy = "uuid")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    @ManyToOne
   @JoinColumn(name = "INSTITUTION")
    public Institution getInstitution() {
        return institution;
    }

    public void setInstitution(Institution institution) {
        this.institution = institution;
    }
    @ManyToOne
   @JoinColumn(name = "LEAVE_REASON_ID")
    public LeaveReason getLeaveReason() {
        return leaveReason;
    }

    public void setLeaveReason(LeaveReason leaveReason) {
        this.leaveReason = leaveReason;
    }
@Column(name = "PASSIVE_DATE")
    @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
    public Date getPassiveDate() {
        return passiveDate;
    }

    public void setPassiveDate(Date passiveDate) {
        this.passiveDate = passiveDate;
    }
    @ManyToOne
   @JoinColumn(name = "POS_TYPE_ID")
    public PosType getPosType() {
        return posType;
    }

    public void setPosType(PosType posType) {
        this.posType = posType;
    }
   @Column(name = "POSITION", length = 200)
    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }
   @Column(name = "STATUS", length = 50)
    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }
   @Column(name = "TRIAL_PERIOD", length = 50)
    public Boolean getTrialPeriod() {
        return trialPeriod;
    }

    public void setTrialPeriod(Boolean trialPeriod) {
        this.trialPeriod = trialPeriod;
    }

    @Override
    public String toString() {
        return "WorkPosition{" + "id=" + id + "institution=" + institution.getId() + "employment=" + employment.getId() + "discriminator=" + discriminator + "position=" + position + "trialPeriod=" + trialPeriod + "posType=" + posType + "status=" + status + "activeDate=" + activeDate + "passiveDate=" + passiveDate + "startDate=" + startDate + "endDate=" + endDate + "emplReason=" + emplReason + "leaveReason=" + leaveReason + "experience=" + experience + '}';
    }

    

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final WorkPosition other = (WorkPosition) obj;
        if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
            return false;
        }
        if (this.institution != other.institution && (this.institution == null || !this.institution.equals(other.institution))) {
            return false;
        }
        if (this.employment != other.employment && (this.employment == null || !this.employment.equals(other.employment))) {
            return false;
        }
        if ((this.discriminator == null) ? (other.discriminator != null) : !this.discriminator.equals(other.discriminator)) {
            return false;
        }
        if ((this.position == null) ? (other.position != null) : !this.position.equals(other.position)) {
            return false;
        }
        if (this.trialPeriod != other.trialPeriod && (this.trialPeriod == null || !this.trialPeriod.equals(other.trialPeriod))) {
            return false;
        }
        if (this.posType != other.posType && (this.posType == null || !this.posType.equals(other.posType))) {
            return false;
        }
        if (this.status != other.status && (this.status == null || !this.status.equals(other.status))) {
            return false;
        }
        if (this.activeDate != other.activeDate && (this.activeDate == null || !this.activeDate.equals(other.activeDate))) {
            return false;
        }
        if (this.passiveDate != other.passiveDate && (this.passiveDate == null || !this.passiveDate.equals(other.passiveDate))) {
            return false;
        }
        if (this.startDate != other.startDate && (this.startDate == null || !this.startDate.equals(other.startDate))) {
            return false;
        }
        if (this.endDate != other.endDate && (this.endDate == null || !this.endDate.equals(other.endDate))) {
            return false;
        }
        if (this.emplReason != other.emplReason && (this.emplReason == null || !this.emplReason.equals(other.emplReason))) {
            return false;
        }
        if (this.leaveReason != other.leaveReason && (this.leaveReason == null || !this.leaveReason.equals(other.leaveReason))) {
            return false;
        }
        if ((this.experience == null) ? (other.experience != null) : !this.experience.equals(other.experience)) {
            return false;
        }
        return true;
    }

    

    @Override
    public int hashCode() {
        throw new UnsupportedOperationException("Not supported yet.");
    }



}
